from Libs.TestCPy import cpyAdd, cpyStringAdd, cpySumTo
from time import time
# CPython原生库测试
c = 1000000

s = time()
for _ in range(c):
    cpyAdd(1, 2)

print(f"CPY耗时: {round(time() - s, 3)}s")

def pyAdd(a, b):
    return a + b

s = time()
for _ in range(c):
    pyAdd(1, 2)

print(f"PY耗时: {round(time() - s, 3)}s")

s = time()
for _ in range(10000):
    cpyStringAdd("你好, ", "世界world")
print(f"CPY耗时: {round(time() - s, 3)}s")

s = time()
for _ in range(10000):
    cpySumTo(1, 100000, 1)
print(f"CPY耗时: {round(time() - s, 3)}s")